<meta charset="UTF-8">
<?php
require ('./lib/init.php');

if (isset($_GET['cat_id'])){
    $where = " and art.cat_id = $_GET[cat_id]" ;
}else{
    $where = "";
}
// 查询显示所有栏目
$sql = "select cat_name,cat_id,cat_num from cat";
$cats = mGetAll($sql);
//查询文章
$sql = "select art.art_id,author,title,content,pubtime,comm,cat_name,thumb from art inner join cat on 
art.cat_id = cat.cat_id where 1 " . $where . ' order by pubtime desc';
$arts = mGetAll($sql);

if (empty($arts)){
    header('location:showallarticle.php');
}


require (ROOT.'/view/front/showallarticle.html');
